﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Hypermarket_Serial_Port
{
    class Constant
    {
        /******************** UI Init***************/
        public const int CMBBAUDRATE_INIT = 3;
        public const int CMBPARITY_INIT = 0;
        public const int CMBDATABIT_INIT = 0;
        public const int CMBSTOPBIT_INIT = 1;
        public const int CMBPORT_INIT = 0;

        public const string IINT_COMPORT_ERROR_MSG = "There are no COM Ports detected on this computer.\nPlease install a COM Port and restart this app.";
        public const string INIT_COMPORT_ERROR_CAPTION = "No COM Ports Installed";

        public const string OPEN_COMPORT_ERROR_MSG = "Could not open the COM port.  Most likely it is already in use, has been removed, or is unavailable.";
        public const string OPEN_COMPORT_ERROR_CAPTION = "COM Port Unavalible";
        /******************End UI Init**************/

        /*******************************************Select Commands********************************************/
        public const string STOCK_PRODUCT_DISCOUNT_TABLE_SELECT_COMMAND = "SELECT P.Name AS Name,S.ExpireDate AS ExpireDate, S.SellingPrice AS SellingPrice, S.ImportPrice AS ImportPrice, S.Quantity AS Quantity, S.BatchID AS BatchID, S.ProductID AS ProductID, D.BundleUnit AS BundleUnit, D.FreeItemQuantity AS FreeItemQuantity, D.Discount AS Discount FROM Stock S, Discount D, Product P WHERE P.ProductID = S.ProductID AND P.ProductID = D.ProductID  AND S.ProductID = D.ProductID AND S.Quantity > 0 ORDER BY ExpireDate ASC";
        public const string CASHIER_TABLE_SELECT_COMMAND = "SELECT StaffID AS CashierID, Password AS Password FROM Staff AS Cashier WHERE Position = 'Cashier'";
        public const string STOCK_PRODUCT_TABLE_SELECT_COMMAND = "SELECT P.Name AS Name,S.ProductID AS ProductID, S.BatchID AS BatchID, S.ExpireDate AS ExpireDate, S.Quantity AS Quantity, S.SellingPrice AS SellingPrice, S.ImportPrice AS ImportPrice FROM Stock S, Product P WHERE P.ProductID = S.ProductID AND S.Quantity > 0 ORDER BY ExpireDate ASC";
        public const string DISCOUNT_TABLE_SELECT_COMMAND = "SELECT * FROM Discount";
        public const string TRANSACTION_TABLE_SELECT_COMMAND = "SELECT * FROM Transactions ORDER BY TransactionID ASC";
        public const string CHECKOUTITEM_TABLE_SELECT_COMMAND = "SELECT * FROM CheckOutItem";
        public const string STOCK_TABLE_SELECT_COMMAND = "SELECT * FROM stock";
        public const string ACTIVED_CASHIERREGISTER_SELECT_COMMAND = "SELECT * FROM CashierRegister WHERE Status = 'Activated'";
        public const string ACTIVED_PRICETAG_SELECT_COMMAND = "SELECT * FROM PriceTag WHERE Status = 'Activated'";
        public const string SELECT_ACITVATED_MACHINE = "Status = 'Activated'";
        /*************************************************End*************************************************/

        /******************All About Tables************************/
        public const string CASHIER_TABLE = "Cashier";
        public const string STOCK_PRODUCT_DISCOUNT_TABLE = "StockProductDiscount";
        public const string STOCK_PRODUCT_TABLE = "StockProduct";
        public const string CHECKOUTITEM_TABLE = "CheckOutItem";
        public const string TRANSACTION_TABLE = "Transactions";
        public const string STOCK_TABLE = "Stock";
        public const string CASHIERREGISTER_TABLE = "CashierRegistor";
        public const string PRICETAG_TABLE = "PriceTag";
        //Columns Cashier
        public const string CASHIER_ID = "CashierID";
        public const string CASHIER_PASSWORD = "Password";
        //Columns Machine
        public const string CASHIERREGISTER_ID = "ID";
        public const string PRICETAG_ID = "ID";
        public const string PRICETAG_PRODUCTID = "ProductID";
        public const string MACHINE_STATUS = "Status";
        public const string MACHINE_DEACTIVIED = "Deactivated";
        
        //Columns Product
        public const string PRODUCT_ID = "ProductID";
        public const string BATCH_ID = "BatchID";
        public const string IMPORT_PRICE= "ImportPrice";
        public const string NAME = "Name";
        public const string EXPIRE_DATE = "ExpireDate";
        public const string SELLING_PRICE = "SellingPrice";
        public const string BUNDLE_UNIT = "BundleUnit";
        public const string FREE_ITEM_QUANTITY = "FreeItemQuantity";
        public const string DISCOUNT = "Discount";
        public const string QUANTITY = "Quantity";
        public const string TRANSACTION_ID = "TransactionID";
        public const string MACHINE_ID = "MachineID";
        /*****************End Table**************************/

        /*********************Program Message**********************/
        public const string TYPE_ERROR = "Type a valid type!";
        public const string PROGRAM_ERROR = "Error Occur!";
        public const string MSG_PRODUCT_NOT_FOUND = "Product Not Availiable!";
        public const string MSG_NOTENOUGH_QUANTITY = "This product is short of demand, only left ";
        public const string MSG_QUANTITY_ERROR = "Please type in valid quantity!";
        public const string MSG_CASHIERID_ERROR = "Wrong Info!";
        public const string MSG_MACHINE_DUPLICATE = "Cashier is used";
        public const string LOGIN_FIRST_MSG = "Please login first!";
        public const string START_TRANSACTION_FIRST = "Please start a transaction first!";
        public const string ADD_TRANSACTION_FIRST = "Please add a transaction first!";
        public const string NO_ITEM = "No such item, please check the barcode";
        public const string CANCEL_TRANSACTION_MSG = "Successfully cancel tansaction: ";
        public const string CANCEL_ALL_TRANSACTIONS_MSG = "Sucessfully cancel all transactions!";
        public const string CHECKOUT_FINISH_MSG = "Thanks for coming, hope see you soon!";
        public const string PURCHASED_ITEM_MSG = "Purchased Item: ";
        public const string TOTALPRICE_MSG = "Total Price: ";
        public const string MSG_SCANNED = "Scanned item";
        public const string MSG_WELCOME = "Welcome ";
        public const string LOGIN_TYPE = "1F";
        public const string ADDTRANSACTION_TYPE = "25";

        public const string SUCCESS= "Y";
        public const string FAIL = "N";
        /*********************End Program Message******************/

        /*********************Operator*****************************/
        public const string EQUAL = "=";
        public const string MORE_THAN = ">";
        public const string SPACE = " ";
        public const string SINGAL_QUOTE = "'";
        public const string AND = " AND ";
        public const string OR = " OR ";
        public const string COLON = ":";
        public const string DALLOR = "$";
        public const string PERCENTAGE = "%";
        public const string ZERO_PERCENTAGE = "0";
        public const string NEWLINE = "\r\n";
        public const string NEW_TAB = "\t";
        public const int ONE = 1;
        public const int TWO = 2;
        public const int THREE = 3;
        public const int FOUR = 4;
        public const int ZERO = 0;
        public const int MIN_DISCOUNT = 0;
        public const int MIN_QUALITY = 0;
        public const int MIN_ROW_COUNT = 0;
        public const char STRING_PAD = '0';
        public const string STRING_ZERO = "0";
        public const double DOUBLE_INITIAL_VALUE = 0.00;
        /*********************End Operator*************************/

        /*********************Protocol*****************************/
        public const byte PROTOCOL_START_STOP_BYTE = 0x7E;

        public const int PROTOCOL_ACK_SZIE = 5;
        public const int PROTOCOL_PRICETAG_SZIE = 6;
        /********************End Protocol**************************/
    }
}
